<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>管理中心 - 添加广告 </title>
        <meta name="robots" content="noindex, nofollow"/>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="__PUBLIC__/styles/general.css" rel="stylesheet" type="text/css" />
        <link href="__PUBLIC__/styles/main.css" rel="stylesheet" type="text/css" />
        <script language="JavaScript" src="__PUBLIC__/Js/jquery.js"></script>
         <script src="__PUBLIC__/js/ajaxupload.js" type="text/javascript"></script>
    </head>
    <body>

        <h1>
            <span class="action-span"><a href="__APP__/Admin/Ad/showList">广告列表</a></span>
            <span class="action-span1"><a href="index.php?act=main">管理中心</a> </span><span id="search_id" class="action-span1"> - 添加广告</span>
            <div style="clear:both"></div>
        </h1>
        <!-- start add new category form -->
        <div class="main-div">
            <form action="__APP__/Admin/Ad/add" method="post" name="theForm">
                <table width="100%" id="general-table">
                   
                    <tr id="measure_unit">
                        <td class="label">标题:</td>
                        <td>
                            <input type="text" name="title" value="{$Ad.title}"/>
                        </td>
                    </tr>
                    <tr id="measure_unit">
                        <td class="label">图片链接:</td>
                        <td>
                            <input type="text" name="url" value="{$Ad.url}"/>
                        </td>
                    </tr>
                    <tr id="measure_unit">
                        <td class="label">文字链接:</td>
                        <td>
                            <input type="text" name="url_text" value="{$Ad.url_text}"/>
                        </td>
                    </tr>
                    <tr id="measure_unit">
                        <td class="label">类型:</td>
                        <td>
                         <input type="radio" name="type" value="999" />首页
                         <foreach name="hangye" item="one">
                            <input type="radio" name="type" value="{$one.value}" />{$one.name}
                        </foreach>
                        <foreach name="hangye" item="one">
                            <input type="radio" name="type" value="{$one.value}_right" />{$one.name}-右侧
                        </foreach>
                        
                        </td>
                    </tr>
                    <tr>
                        <td class="label">图片:</td>
                        <td>
                            <img id="ad_img" src="{$Ad.img}">
                            <input id="upload_button" type="button" value="添加相关图片（限于png，gif，jpg，jpeg格式，大小限制3M" />
                            <input id="img_src" name="img" type="hidden" value="{$Ad.img}"/>
                        </td>
                    </tr>
                </table>
                <div class="button-div">
                    <input type="hidden" value="{$Ad.id}" name="id"/>
                    <input type="submit" value=" 确定 " class="button"/>
                    <input type="reset" value=" 重置 " class="button"/>
                </div>

            </form>
        </div>


        <div id="footer">
        </div>

    </body>
</html>
<script>
$(document).ready(function(){

        var button = $('#upload_button'), interval;
        var fileType = "all",fileNum = "one";

        new AjaxUpload(button,{
            action: '__APP__/Share/uploadPic',
            /*data:{
            'buttoninfo':button.text()
        },*/
            name: 'photo',
            onSubmit : function(file, ext){

            },
            onComplete: function(file, response){
                if(response != "success"){
                    img = 'Uploads/thumb_'+ response;
                    img_src = '__ROOT__/Public/Uploads/thumb_'+ response;
                    $("#ad_img").attr('src', img_src);
                    $("#img_src").val(img);
                }
                if(response == "success"){
                    alert('图片类型错误，请重试！');
                }
            }
        });

    });
</script>